package com.cn.por.auto.enums;

import java.util.function.Supplier;

/**
 * sql脚本枚举类
 */
public enum SqlEnum {

    MYSQL_GET_TABLES(()->"SELECT A.TABLE_SCHEMA tableSchema, lower(A.TABLE_NAME) tableName, A.TABLE_ROWS tableRows, date_format(A.CREATE_TIME,'%Y-%m-%d') createTime, A.TABLE_COMMENT tableComment FROM INFORMATION_SCHEMA.TABLES A WHERE A.TABLE_SCHEMA =?"),

    MYSQL_GET_COLUMNS(()->"SELECT A.TABLE_SCHEMA tableSchema, A.TABLE_NAME tableName,lower(A.COLUMN_NAME) columnName,A.ORDINAL_POSITION ordinalPosition, A.DATA_TYPE dataType, A.COLUMN_TYPE columnType, A.COLUMN_COMMENT columnComment FROM INFORMATION_SCHEMA.COLUMNS A WHERE A.TABLE_NAME=? ORDER BY A.TABLE_SCHEMA,A.TABLE_NAME,A.ORDINAL_POSITION");
    private final Supplier<String> querySupplier;
    SqlEnum(Supplier<String> querySupplie) {
        this.querySupplier = querySupplie;
    }
    public String getQuery(){
        return this.querySupplier.get();
    }
}
